<?php
	require_once("../conexion/conexion.php");
	if(isset($_GET['var']))
	{ $numFac = $_GET['var'];}
	//echo strtoupper('este es mi texto en minusculas que pasara a mayusculas');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Ventana Detalle</title>
<link href="../Estilos/global.css" rel="stylesheet" type="text/css" />
<link href="../Estilos/local.css" rel="stylesheet" type="text/css" />
<link href="../Estilos/CssTabla3.css" rel="stylesheet" type="text/css" />
<script src="../include_js/jquery.js" type="text/javascript"></script>
<style>
.filaPar
{
	background:#81D371; 
	font-family:Verdana, Arial, Helvetica, sans-serif; 
    font-size:11px;
	text-align:center;
	vertical-align:middle;
	padding:3px;
}
.filaImpar
{
	background:#AEF1A1;
	font-family:Verdana, Arial, Helvetica, sans-serif; 
    font-size:11px;
	text-align:center;
	vertical-align:middle;
	padding:3px;
}
</style>
</head>

<body style="background:#CCCCCC">
<form name="form_Ventana" id="form_Ventana" method="post" >
<div id="acpinner3">
<div id="acppage" style="background:#EFEFEF">
<div class='option2'>
  <label style="font:Verdana, Arial, Helvetica, sans-serif; color:#0066CC; font-weight:bold;">Detalle de la Factura N&deg; <? echo $numFac;?> .</label>
</div>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="uno" >
			<thead>
  			<tr>
    			<th width="34%" style="border:1px solid #FFFFFF;">Cliente</th>
    			<th width="12%" style="border:1px solid #FFFFFF;">fono</th>
    			<th width="11%" style="border:1px solid #FFFFFF;">Porcentaje</th>
    			<th width="13%" style="border:1px solid #FFFFFF;">F.Pago</th>
    			<th width="15%" style="border:1px solid #FFFFFF;">Estado</th>
				<th width="15%" style="border:1px solid #FFFFFF;">neto + iva</th>
  			</tr>
 			</thead>
			<?php
				$con = new Conexion();
				$con2 = $con->conexionBD("fpproduccion");
				$sql="select
						CliRSocial,
						CliFono,
						FacPorcentaje,
						ConVentaDescrip,
						FacEstado,
						FacPago
						
						from factura
						inner join clientes on
						clientes.CliRut=factura.CliRut
						inner join condicionventa on
						condicionventa.ConVentaCod=factura.ConVentaCod
						where FacCod='".$numFac."'";
				$resultado = mysql_query($sql) or die ($con->error_mysql("Error en la consulta".mysql_error()));
				
				while($reg = mysql_fetch_array($resultado))
				{
					
						echo "<tr class=\"filaImpar\">";
						echo "<td width=\"34%\" class=\"filaImpar\">".utf8_decode($reg['CliRSocial'])."</td>";
						echo "<td width=\"12%\" class=\"filaImpar\">".$reg['CliFono']."</td>";
						echo "<td width=\"11%\" class=\"filaImpar\">".$reg['FacPorcentaje']."</td>";
						echo "<td width=\"13%\" class=\"filaImpar\">".$reg['ConVentaDescrip']."</td>";
						echo "<td width=\"15%\" class=\"filaImpar\">".$reg['FacEstado']."</td>";
						echo "<td width=\"15%\" class=\"filaImpar\">$".number_format ($reg['FacPago'],0,',','.')."</td>";
						echo "</tr>";
				}
				$con->cerrarBD();
			?>
</table>
<br />
<div align="center">
<table width="50%" border="0" cellpadding="0" cellspacing="0" class="uno">
<thead>
<tr>
    <th width="35%" style="border:1px solid #FFFFFF;">n&deg; formulario</th>
    <th width="65%" style="border:1px solid #FFFFFF;">an&Aacute;lisis</th>
</tr>
</thead>
<?php
				$con = new Conexion();
				$con2 = $con->conexionBD("fpproduccion");
				$sql="select distinct
						formulariofactura.ForNumero as numero,
						TSusNombre
						
						from factura
						inner join formulariofactura on
						formulariofactura.FacCod=factura.FacCod
						inner join formulario on
						formulario.ForNumero=formulariofactura.ForNumero
						inner join analisis on
						analisis.ForNumero=formulario.ForNumero
						inner join tiposustancia on
						tiposustancia.TSusNum=analisis.TSusNum
						where factura.FacCod='".$numFac."'";
				$resultado = mysql_query($sql) or die ($con->error_mysql("Error en la consulta".mysql_error()));
				$cont=1;
				while($reg = mysql_fetch_array($resultado))
				{
					if(($cont % 2)==0)
					{
						echo "<tr class=\"filaPar\">";
						echo "<td width=\"35%\" class=\"filaPar\">".$reg['numero']."</td>";
						echo "<td width=\"65%\" class=\"filaPar\">".$reg['TSusNombre']."</td>";
						echo "</tr>";
					}
					else
					{
						echo "<tr class=\"filaImpar\">";
						echo "<td width=\"35%\" class=\"filaImpar\">".$reg['numero']."</td>";
						echo "<td width=\"65%\" class=\"filaImpar\">".$reg['TSusNombre']."</td>";
						echo "</tr>";
					}
					$cont++;
				}
				$con->cerrarBD();
			?>
</table>
</div>
</div>
</div>
</form>
</body>
</html>
